HA$PBExportHeader$w_dw_print_options.srw
$PBExportComments$Print Options Dialog
forward
global type w_dw_print_options from w_center
end type
type p_2 from picture within w_dw_print_options
end type
type p_1 from picture within w_dw_print_options
end type
type cbx_1 from checkbox within w_dw_print_options
end type
type cb_5 from commandbutton within w_dw_print_options
end type
type cb_4 from commandbutton within w_dw_print_options
end type
type cb_3 from commandbutton within w_dw_print_options
end type
type cb_2 from commandbutton within w_dw_print_options
end type
type cb_1 from commandbutton within w_dw_print_options
end type
type ddlb_1 from dropdownlistbox within w_dw_print_options
end type
type ddlb_2 from dropdownlistbox within w_dw_print_options
end type
type st_6 from statictext within w_dw_print_options
end type
type st_5 from statictext within w_dw_print_options
end type
type ddlb_range from dropdownlistbox within w_dw_print_options
end type
type st_4 from statictext within w_dw_print_options
end type
type cb_printer from commandbutton within w_dw_print_options
end type
type cb_cancel from commandbutton within w_dw_print_options
end type
type cbx_collate from checkbox within w_dw_print_options
end type
type cbx_print_to_file from checkbox within w_dw_print_options
end type
type st_3 from statictext within w_dw_print_options
end type
type sle_page_range from singlelineedit within w_dw_print_options
end type
type rb_pages from radiobutton within w_dw_print_options
end type
type rb_current_page from radiobutton within w_dw_print_options
end type
type rb_all from radiobutton within w_dw_print_options
end type
type em_copies from editmask within w_dw_print_options
end type
type st_2 from statictext within w_dw_print_options
end type
type sle_printer from singlelineedit within w_dw_print_options
end type
type st_1 from statictext within w_dw_print_options
end type
type cb_ok from commandbutton within w_dw_print_options
end type
type gb_1 from groupbox within w_dw_print_options
end type
type gb_2 from groupbox within w_dw_print_options
end type
type gb_3 from groupbox within w_dw_print_options
end type
type ddlb_3 from dropdownlistbox within w_dw_print_options
end type
type gb_4 from groupbox within w_dw_print_options
end type
end forward

global type w_dw_print_options from w_center
integer x = 672
integer y = 268
integer width = 1934
integer height = 1424
string title = "Opciones de Impresi$$HEX1$$f300$$ENDHEX$$n del Reporte"
boolean minbox = false
boolean maxbox = false
boolean resizable = false
windowtype windowtype = response!
long backcolor = 78748035
toolbaralignment toolbaralignment = alignatleft!
p_2 p_2
p_1 p_1
cbx_1 cbx_1
cb_5 cb_5
cb_4 cb_4
cb_3 cb_3
cb_2 cb_2
cb_1 cb_1
ddlb_1 ddlb_1
ddlb_2 ddlb_2
st_6 st_6
st_5 st_5
ddlb_range ddlb_range
st_4 st_4
cb_printer cb_printer
cb_cancel cb_cancel
cbx_collate cbx_collate
cbx_print_to_file cbx_print_to_file
st_3 st_3
sle_page_range sle_page_range
rb_pages rb_pages
rb_current_page rb_current_page
rb_all rb_all
em_copies em_copies
st_2 st_2
sle_printer sle_printer
st_1 st_1
cb_ok cb_ok
gb_1 gb_1
gb_2 gb_2
gb_3 gb_3
ddlb_3 ddlb_3
gb_4 gb_4
end type
global w_dw_print_options w_dw_print_options

type variables
string is_page_range
datawindow idw_dw
integer ii_orientacion , ii_tama$$HEX1$$f100$$ENDHEX$$o 
end variables

forward prototypes
private subroutine wf_page_range (radiobutton who)
end prototypes

private subroutine wf_page_range (radiobutton who);choose case who
	case rb_all
		sle_page_range.text = ''
		sle_page_range.enabled = false
		is_page_range = 'a'
	case rb_current_page
		sle_page_range.text = ''
		sle_page_range.enabled = false
		is_page_range = 'c'
	case rb_pages		
		sle_page_range.enabled = true
		is_page_range = 'p'
end choose
end subroutine

event open;call super::open;// we assume that this window will be opened using openwitparm and that
// a datawindow control will be passed to it
integer li_tam
idw_dw = message.powerobjectparm
sle_printer.text = idw_dw.describe('datawindow.printer')
//is_page_range = 'a'
is_page_range = 'c'
idw_dw.modify('datawindow.print.Preview=yes')

li_tam = integer(idw_dw.describe('datawindow.Print.Paper.Size')) 
ddlb_1.selectitem( li_tam + 1 )
ii_tama$$HEX1$$f100$$ENDHEX$$o = li_tam + 1

li_tam = integer(idw_dw.describe('datawindow.Print.Orientation')) 
ddlb_2.selectitem(li_tam + 1 )
ii_orientacion = li_tam + 1 

rb_current_page.checked = true
sle_page_range.text = ''
sle_page_range.enabled = false








end event

on w_dw_print_options.create
int iCurrent
call super::create
this.p_2=create p_2
this.p_1=create p_1
this.cbx_1=create cbx_1
this.cb_5=create cb_5
this.cb_4=create cb_4
this.cb_3=create cb_3
this.cb_2=create cb_2
this.cb_1=create cb_1
this.ddlb_1=create ddlb_1
this.ddlb_2=create ddlb_2
this.st_6=create st_6
this.st_5=create st_5
this.ddlb_range=create ddlb_range
this.st_4=create st_4
this.cb_printer=create cb_printer
this.cb_cancel=create cb_cancel
this.cbx_collate=create cbx_collate
this.cbx_print_to_file=create cbx_print_to_file
this.st_3=create st_3
this.sle_page_range=create sle_page_range
this.rb_pages=create rb_pages
this.rb_current_page=create rb_current_page
this.rb_all=create rb_all
this.em_copies=create em_copies
this.st_2=create st_2
this.sle_printer=create sle_printer
this.st_1=create st_1
this.cb_ok=create cb_ok
this.gb_1=create gb_1
this.gb_2=create gb_2
this.gb_3=create gb_3
this.ddlb_3=create ddlb_3
this.gb_4=create gb_4
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.p_2
this.Control[iCurrent+2]=this.p_1
this.Control[iCurrent+3]=this.cbx_1
this.Control[iCurrent+4]=this.cb_5
this.Control[iCurrent+5]=this.cb_4
this.Control[iCurrent+6]=this.cb_3
this.Control[iCurrent+7]=this.cb_2
this.Control[iCurrent+8]=this.cb_1
this.Control[iCurrent+9]=this.ddlb_1
this.Control[iCurrent+10]=this.ddlb_2
this.Control[iCurrent+11]=this.st_6
this.Control[iCurrent+12]=this.st_5
this.Control[iCurrent+13]=this.ddlb_range
this.Control[iCurrent+14]=this.st_4
this.Control[iCurrent+15]=this.cb_printer
this.Control[iCurrent+16]=this.cb_cancel
this.Control[iCurrent+17]=this.cbx_collate
this.Control[iCurrent+18]=this.cbx_print_to_file
this.Control[iCurrent+19]=this.st_3
this.Control[iCurrent+20]=this.sle_page_range
this.Control[iCurrent+21]=this.rb_pages
this.Control[iCurrent+22]=this.rb_current_page
this.Control[iCurrent+23]=this.rb_all
this.Control[iCurrent+24]=this.em_copies
this.Control[iCurrent+25]=this.st_2
this.Control[iCurrent+26]=this.sle_printer
this.Control[iCurrent+27]=this.st_1
this.Control[iCurrent+28]=this.cb_ok
this.Control[iCurrent+29]=this.gb_1
this.Control[iCurrent+30]=this.gb_2
this.Control[iCurrent+31]=this.gb_3
this.Control[iCurrent+32]=this.ddlb_3
this.Control[iCurrent+33]=this.gb_4
end on

on w_dw_print_options.destroy
call super::destroy
destroy(this.p_2)
destroy(this.p_1)
destroy(this.cbx_1)
destroy(this.cb_5)
destroy(this.cb_4)
destroy(this.cb_3)
destroy(this.cb_2)
destroy(this.cb_1)
destroy(this.ddlb_1)
destroy(this.ddlb_2)
destroy(this.st_6)
destroy(this.st_5)
destroy(this.ddlb_range)
destroy(this.st_4)
destroy(this.cb_printer)
destroy(this.cb_cancel)
destroy(this.cbx_collate)
destroy(this.cbx_print_to_file)
destroy(this.st_3)
destroy(this.sle_page_range)
destroy(this.rb_pages)
destroy(this.rb_current_page)
destroy(this.rb_all)
destroy(this.em_copies)
destroy(this.st_2)
destroy(this.sle_printer)
destroy(this.st_1)
destroy(this.cb_ok)
destroy(this.gb_1)
destroy(this.gb_2)
destroy(this.gb_3)
destroy(this.ddlb_3)
destroy(this.gb_4)
end on

type p_2 from picture within w_dw_print_options
integer x = 576
integer y = 1176
integer width = 91
integer height = 76
string picturename = "Search!"
boolean focusrectangle = false
end type

event clicked;string ls_zoom
//ls_zoom=Trim(ddlb_3.Text)
//////parent.event static trigger ue_zoom(is_zoom)
////
//idw_dw.modify("datawindow.print.preview.zoom="   + ls_zoom)
end event

type p_1 from picture within w_dw_print_options
integer x = 1541
integer y = 1184
integer width = 73
integer height = 64
boolean originalsize = true
string picturename = "Custom032!"
boolean focusrectangle = false
end type

type cbx_1 from checkbox within w_dw_print_options
integer x = 1632
integer y = 1176
integer width = 155
integer height = 80
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "SI"
boolean lefttext = true
boolean righttoleft = true
end type

event clicked;string is_checked

if this.checked then is_checked='Yes' else is_checked='No'
idw_dw.modify("datawindow.print.preview.rulers=" + is_checked)
end event

type cb_5 from commandbutton within w_dw_print_options
integer x = 1029
integer y = 1172
integer width = 169
integer height = 96
integer taborder = 130
integer textsize = -10
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "+"
end type

event clicked;w_dw_print_options.idw_dw.object.datawindow.zoom=string(long(w_dw_print_options.idw_dw.object.datawindow.zoom) + 2)
end event

type cb_4 from commandbutton within w_dw_print_options
integer x = 832
integer y = 1172
integer width = 174
integer height = 96
integer taborder = 120
integer textsize = -10
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "-"
end type

event clicked;w_dw_print_options.idw_dw.object.datawindow.zoom=string(long(w_dw_print_options.idw_dw.object.datawindow.zoom) - 2)
end event

type cb_3 from commandbutton within w_dw_print_options
boolean visible = false
integer x = 1010
integer y = 8
integer width = 393
integer height = 92
integer taborder = 110
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
string text = "Preview"
boolean default = true
end type

event clicked;string tmp, command
long row 
string	docname, named
int	value

choose case lower(left(ddlb_range.text,1)) // determine rangeinclude (all,even,odd)
	case 'a' // all
		tmp = '0'
	case 'e' // even
		tmp = '1'
	case 'o' //odd
		tmp = '2'
end choose
command = 'datawindow.print.page.rangeinclude = '+tmp
if cbx_collate.checked then // collate output ?
	command = command +  " datawindow.print.collate = yes"
else
	command = command +  " datawindow.print.collate = no"
end if
choose case is_page_range // did they pick a page range?
	case 'a'  // all
		tmp = ''
	case 'c' // current page?
		row = idw_dw.getrow()
		tmp = idw_dw.describe("evaluate('page()',"+string(row)+")")
	case 'p' // a range?
		tmp = sle_page_range.text
end choose		
if len(tmp) > 0 then command = command +  " datawindow.print.page.range = '"+tmp+"'"

// number of copies ?
if len(em_copies.text) > 0 then command = command +  " datawindow.print.copies = "+em_copies.text

if cbx_print_to_file.checked then // print to file ?
	value = GetFileSaveName("Print To File", docname, named, "PRN", "Print (*.PRN),*.PRN")
	if value = 1 then 
		command = command + " datawindow.print.filename = '"+docname+"'"
	else // they canceled out of the dialog so quit completely
		return
	end if
end if
// Orientacion y tama$$HEX1$$f100$$ENDHEX$$o de la Hoja a Imprimir
if ii_orientacion<>-1 then
//	idw.Object.DataWindow.Print.Orientation = ii_orientacion - 1
		command = command + " datawindow.Print.Orientation = '"+string(ii_orientacion -1 ) +"'" 
end if
if ii_tama$$HEX1$$f100$$ENDHEX$$o<>-1 then
		command = command + " datawindow.Print.Paper.Size = '"+string(ii_tama$$HEX1$$f100$$ENDHEX$$o -1 )+"'"
end if


// now alter the datawindow
tmp = idw_dw.modify(command)
if len(tmp) > 0 then // if error the display the 
	messagebox('Error Setting Print Options','Error message = ' + tmp + '~r~nCommand = ' + command)
	return
end if

end event

type cb_2 from commandbutton within w_dw_print_options
integer x = 1495
integer y = 424
integer width = 393
integer height = 92
integer taborder = 50
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
string text = "Guardar como..."
end type

event clicked;idw_dw.SAveas()
end event

type cb_1 from commandbutton within w_dw_print_options
integer x = 1495
integer y = 220
integer width = 393
integer height = 88
integer taborder = 40
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
string text = "Excel"
end type

event clicked;integer li_valor 
string ls_ruta_y_archivo , ls_archivo

li_valor = GetFileSaveName('Guardar como', ls_ruta_y_archivo, ls_archivo, 'xls', 'Excel Files (*.xls),*.xls')

if li_valor = 1 then 
	if fileexists(ls_archivo) then
		if messagebox('Mensaje del Sistema','El archivo ya existe~n$$HEX1$$bf00$$ENDHEX$$Desea Reemplazarlo?',exclamation!,yesno!) = 2 then return
		if FileDelete(ls_archivo) = false then 
			messagebox('Mensaje del Sistema','Ha ocurrido un error generando el archivo !!!',stopsign!)
			return
		end if	
	end if	
	uf_save_dw_as_excel(idw_dw , ls_ruta_y_archivo )
end if





end event

type ddlb_1 from dropdownlistbox within w_dw_print_options
integer x = 416
integer y = 788
integer width = 1303
integer height = 768
integer taborder = 30
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
string text = "none"
boolean sorted = false
boolean vscrollbar = true
string item[] = {"Tama$$HEX1$$f100$$ENDHEX$$o por Defecto de su Impresora","Letter 8 1/2 x 11 in","LetterSmall 8 1/2 x 11in","Tabloid 17 x 11 inches","Ledger 17 x 11 in","Legal 8 1/2 x 14 in","Statement 5 1/2 x 8 1/2 in","Executive 7 1/4 x 10 1/2 in","A3 297 x 420 mm","A4 210 x 297 mm","A4 Small 210 x 297 mm","A5 148 x 210 mm","B4 250 x 354 mm","B5 182 x 257 mm","Folio 8 1/2 x 13 in","Quarto 215 x 275mm","10x14 in","11x17 in","Note 8 1/2 x 11 in","Envelope #9 3 7/8 x 8 7/8","Envelope #10 4 1/8 x 9 1/2","Envelope #11 4 1/2 x 10 3/8","Envelope #12 4 x 11 1/276","Envelope #14 5 x 11 1/2","C size sheet","D size sheet","E size sheet","Envelope DL 110 x 220mm","Envelope C5 162 x 229 mm","Envelope C3 324 x 458 mm","Envelope C4 229 x 324 mm","Envelope C6 114 x 162 mm","Envelope C65 114 x 229 mm","Envelope B4 250 x 353 mm","Envelope B5 176 x 250 mm","Envelope B6 176 x 125 mm","Envelope 110 x 230 mm","Envelope Monarch 3.875 x 7.5 in","6 3/4 Envelope 3 5/8 x 6 1/2 in","US Std Fanfold 14 7/8 x 11 in","German Std Fanfold 8 1/2 x 12 in","German Legal Fanfold 8 1/2 x 13 in","BOLETA"}
borderstyle borderstyle = stylelowered!
end type

event selectionchanged;ii_tama$$HEX1$$f100$$ENDHEX$$o = index
cb_3.triggerevent (clicked!)
end event

type ddlb_2 from dropdownlistbox within w_dw_print_options
integer x = 416
integer y = 884
integer width = 1298
integer height = 324
integer taborder = 30
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
string text = "none"
boolean sorted = false
boolean vscrollbar = true
string item[] = {"Orientacion por Defecto por su Impresora","Landscape","Portrait"}
borderstyle borderstyle = stylelowered!
end type

event selectionchanged;ii_orientacion=index
cb_3.triggerevent (clicked!)
end event

type st_6 from statictext within w_dw_print_options
integer x = 128
integer y = 900
integer width = 270
integer height = 52
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 67108864
string text = "Orientaci$$HEX1$$f300$$ENDHEX$$n:"
boolean focusrectangle = false
end type

type st_5 from statictext within w_dw_print_options
integer x = 123
integer y = 804
integer width = 201
integer height = 52
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 67108864
string text = "Tama$$HEX1$$f100$$ENDHEX$$o:"
boolean focusrectangle = false
end type

type ddlb_range from dropdownlistbox within w_dw_print_options
integer x = 311
integer y = 1008
integer width = 1065
integer height = 288
integer taborder = 120
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
string text = "All Pages In Range"
boolean sorted = false
string item[] = {"All Pages in Range","Even Numbered Pages","Odd Numbered Pages"}
borderstyle borderstyle = stylelowered!
end type

type st_4 from statictext within w_dw_print_options
integer x = 91
integer y = 1020
integer width = 197
integer height = 68
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
boolean enabled = false
string text = "Impr&imir"
alignment alignment = right!
boolean focusrectangle = false
end type

type cb_printer from commandbutton within w_dw_print_options
integer x = 1495
integer y = 320
integer width = 393
integer height = 88
integer taborder = 110
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
string text = "Impres&ora..."
end type

event clicked;printsetup()
sle_printer.text = idw_dw.describe('datawindow.printer')
cb_3.triggerevent (clicked!)
end event

type cb_cancel from commandbutton within w_dw_print_options
integer x = 1495
integer y = 120
integer width = 393
integer height = 88
integer taborder = 100
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
string text = "Cancelar"
boolean cancel = true
end type

on clicked;closewithreturn(parent,-1)
end on

type cbx_collate from checkbox within w_dw_print_options
integer x = 1390
integer y = 644
integer width = 489
integer height = 68
integer taborder = 80
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
string text = "Collate Cop&ies"
boolean checked = true
end type

type cbx_print_to_file from checkbox within w_dw_print_options
integer x = 1390
integer y = 552
integer width = 503
integer height = 68
integer taborder = 70
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
string text = "Imprimir en Arc&hivo"
end type

type st_3 from statictext within w_dw_print_options
integer x = 128
integer y = 620
integer width = 1216
integer height = 112
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
boolean enabled = false
string text = "Ingrese los numeros de las paginas y/o rango de paginas separadas por comas. Por ejemplo, 2,5,8-10"
boolean focusrectangle = false
end type

type sle_page_range from singlelineedit within w_dw_print_options
integer x = 416
integer y = 516
integer width = 882
integer height = 84
integer taborder = 60
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 16777215
boolean autohscroll = false
borderstyle borderstyle = stylelowered!
end type

type rb_pages from radiobutton within w_dw_print_options
integer x = 146
integer y = 528
integer width = 297
integer height = 68
integer taborder = 50
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
string text = "Pa&ginas:"
end type

on clicked;wf_page_range(this)
end on

type rb_current_page from radiobutton within w_dw_print_options
integer x = 146
integer y = 460
integer width = 462
integer height = 68
integer taborder = 40
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
string text = "Pagina Actual"
boolean checked = true
end type

on clicked;wf_page_range(this)
end on

type rb_all from radiobutton within w_dw_print_options
integer x = 146
integer y = 392
integer width = 242
integer height = 68
integer taborder = 30
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
string text = "&Todas"
end type

on clicked;wf_page_range(this)
end on

type em_copies from editmask within w_dw_print_options
integer x = 306
integer y = 216
integer width = 242
integer height = 88
integer taborder = 10
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
string text = "1"
borderstyle borderstyle = stylelowered!
string mask = "#####"
end type

type st_2 from statictext within w_dw_print_options
integer x = 64
integer y = 232
integer width = 210
integer height = 68
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
boolean enabled = false
string text = "Copias::"
boolean focusrectangle = false
end type

type sle_printer from singlelineedit within w_dw_print_options
integer x = 306
integer y = 120
integer width = 864
integer height = 84
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
boolean enabled = false
boolean border = false
boolean autohscroll = false
end type

type st_1 from statictext within w_dw_print_options
integer x = 64
integer y = 120
integer width = 233
integer height = 68
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
boolean enabled = false
string text = "Impresora:"
boolean focusrectangle = false
end type

type cb_ok from commandbutton within w_dw_print_options
integer x = 1495
integer y = 20
integer width = 393
integer height = 88
integer taborder = 90
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
string text = "OK"
boolean default = true
end type

event clicked;string tmp, command,docname, named
long row 
int	value

tmp = '0'
choose case lower(left(ddlb_range.text,1)) // determine rangeinclude (all,even,odd)
	case 'a' // all
		tmp = '0'
	case 'e' // even
		tmp = '1'
	case 'o' //odd
		tmp = '2'
end choose
command = 'datawindow.print.page.rangeinclude = '+tmp
if cbx_collate.checked then // collate output ?
	command = command +  " datawindow.print.collate = yes"
else
	command = command +  " datawindow.print.collate = no"
end if
tmp = ''
choose case is_page_range // did they pick a page range?
	case 'a'  // all
		tmp = ''
	case 'c' // current page?
		row = idw_dw.getrow()
		tmp = idw_dw.describe("evaluate('page()',"+string(row)+")")
	case 'p' // a range?
		tmp = sle_page_range.text
end choose	

if len(tmp) > 0 then command = command +  " datawindow.print.page.range = '"+tmp+"'"

// number of copies ?
if len(em_copies.text) > 0 then command = command +  " datawindow.print.copies = "+em_copies.text

if cbx_print_to_file.checked then // print to file ?
	value = GetFileSaveName("Print To File", docname, named, "PRN", "Print (*.PRN),*.PRN")
	if value = 1 then 
		command = command + " datawindow.print.filename = '"+docname+"'"
	else // they canceled out of the dialog so quit completely
		return
	end if
end if
// Orientacion y tama$$HEX1$$f100$$ENDHEX$$o de la Hoja a Imprimir
if ii_orientacion<>-1 then
//	idw.Object.DataWindow.Print.Orientation = ii_orientacion - 1
		command = command + " datawindow.Print.Orientation = '"+string(ii_orientacion -1 ) +"'" 
end if
if ii_tama$$HEX1$$f100$$ENDHEX$$o<>-1 then
		command = command + " datawindow.Print.Paper.Size = '"+string(ii_tama$$HEX1$$f100$$ENDHEX$$o -1 )+"'"
end if

//f_mensaje(command,4)
// now alter the datawindow
tmp = idw_dw.modify(command)
if len(tmp) > 0 then // if error the display the 
	messagebox('Error Setting Print Options','Error message = ' + tmp + '~r~nCommand = ' + command)
	return
end if

idw_dw.print()

closewithreturn(parent,1)



end event

type gb_1 from groupbox within w_dw_print_options
integer x = 69
integer y = 332
integer width = 1298
integer height = 408
integer taborder = 20
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 78748035
string text = "Rango de Paginas"
end type

type gb_2 from groupbox within w_dw_print_options
integer x = 69
integer y = 732
integer width = 1815
integer height = 268
integer taborder = 20
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 67108864
string text = "Papel"
end type

type gb_3 from groupbox within w_dw_print_options
integer x = 69
integer y = 1112
integer width = 1170
integer height = 180
integer taborder = 120
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "Zoom"
end type

type ddlb_3 from dropdownlistbox within w_dw_print_options
integer x = 114
integer y = 1172
integer width = 448
integer height = 352
integer taborder = 140
boolean bringtotop = true
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
boolean allowedit = true
boolean sorted = false
boolean vscrollbar = true
string item[] = {"200","180","150","120","100","75","50","25"}
borderstyle borderstyle = stylelowered!
end type

event selectionchanged;string ls_zoom
ls_zoom=Trim(This.Text)
//parent.event static trigger ue_zoom(is_zoom)

idw_dw.modify("datawindow.print.preview.zoom="   + ls_zoom)
end event

type gb_4 from groupbox within w_dw_print_options
integer x = 1490
integer y = 1112
integer width = 389
integer height = 180
integer taborder = 140
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "Regla"
end type

